package com.bush.mall.order.controller;

import org.springframework.web.bind.annotation.*;
import com.bush.mall.common.entity.Result;;
import com.bush.mall.order.entity.OrderReturnReasonEntity;
import com.bush.mall.order.service.OrderReturnReasonService;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 退货原因
 * @author RUN
 * @date 2022-11-29
 */
@RestController
@RequestMapping("orderreturnreason")
@Api(tags = "退货原因管理" )
public class OrderReturnReasonController {

    @Resource(name= OrderReturnReasonService.BEAN_ID)
    private OrderReturnReasonService orderReturnReasonService;

    /**
     * 分页查询退货原因列表
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "分页查询退货原因列表")
    @GetMapping("queryForPage")
    public Result queryForPage(Integer current,Integer size){
        return orderReturnReasonService.queryForPage(current,size);
    }

    /**
     * 保存退货原因表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "保存退货原因表单")
    @PostMapping
    public Result saveOrderReturnReason(@RequestBody OrderReturnReasonEntity orderReturnReason){
        return orderReturnReasonService.saveOrderReturnReason(orderReturnReason);
    }

    /**
     * 修改退货原因表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "修改退货原因表单")
    @PutMapping
    public Result updateOrderReturnReason(@RequestBody OrderReturnReasonEntity orderReturnReason){
        return orderReturnReasonService.updateOrderReturnReason(orderReturnReason);
    }

    /**
     * 通过指定id删除退货原因
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "通过指定id删除退货原因")
    @DeleteMapping
    public Result deleteOrderReturnReason(Long id){
        return orderReturnReasonService.deleteOrderReturnReason(id);
    }

}
